<template>
  <div ref="print" id="edit">
    <button v-on:click="commit">提交</button>
    <div>
      姓名：xxx 性别：男 年龄：xxx 科别：消化内科 床号：33 住院号：123456

      {{record}}
    </div>
    {{timeNow()}}
    <el-row :gutter=0>
      <el-col :span=6>
        <div>
          <input class="text" type="date" v-model="record.sxrq" />
          <html-radio-group v-model="record.tys" :options="['已签署','未签署']" />
          <html-radio-group v-model="record.sxmd" :options="['抢救','手术','治疗']" />
          <html-input v-model="record.abo" />
          <html-input v-model="record.rh" />
          <html-input-check per="T" suf="C" check="详见麻醉记录单" v-model="record.sxqtw" />
        </div>
      </el-col>
      <el-col :span=6>
        <div>
          <html-input-scan v-model="record.abo" />
        </div>
      </el-col>
    </el-row>

  </div>
</template>

<script>
import HtmlInputScan from './HtmlInputScan.vue'
import HtmlInput from './HtmlInput.vue'
import HtmlRadioGroup from './HtmlRadioGroup.vue'
import HtmlInputCheck from './HtmlInputCheck.vue'
export default {
  components: {
    HtmlInput,
    HtmlInputScan,
    HtmlRadioGroup,
    HtmlInputCheck
  },
  data() {
    return {
      inputValue: '123',
      phones: ['11', '22'],
      state: undefined,
      isEdit: true,
      record: {
        sxrq: undefined,
        tys: 1,
        sxmd: 1,
        abo: '',
        rh: 'aaa',
        creatorUserId: '',
        creationTime: '',
        auditTime: '',
        auditUserId: ''
      },
      master: {
        billStatus: undefined,
        billNo: '',
        creatorUserId: '',
        creationTime: '',
        auditTime: '',
        auditUserId: ''
      }
    }
  },
  methods: {
    timeNow() {
      var fmt = 'yyyy-MM-dd hh:mm:ss'
      var now = new Date()
      var o = {
        'M+': now.getMonth() + 1, //月份
        'd+': now.getDate(), //日
        'h+': now.getHours(), //小时
        'm+': now.getMinutes(), //分
        's+': now.getSeconds(), //秒
        'q+': Math.floor((now.getMonth() + 3) / 3), //季度
        S: now.getMilliseconds() //毫秒
      }
      if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (now.getFullYear() + '').substr(4 - RegExp.$1.length))
      for (var k in o)
        if (new RegExp('(' + k + ')').test(fmt))
          fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length))
      return fmt
    },
    add() {
      this.isEdit = true
    },
    //保存+审核
    commit() {
      //this.isEdit = false
      this.log(this.record)
    },
    //退审并编辑
    edit() {
      this.isEdit = true
    },
    //取消编辑
    cancel() {
      this.isEdit = false
    },
    //保存
    save() {
      this.isEdit = false
    },
    //作废
    obsolete() {
      this.ShowMsg('作废')
    },
    print() {
      this.$print(this.$refs.print)
    }
  }
}
</script>

<style lang="scss" scoped>
#edit {
  .text {
    color: #000;
    width: 100%;
    height: 50px;
  }
}
</style>
